﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.IBLL;
using KPIS.GERP.GIMS.IDAL;
using KPIS.GERP.GIMS.DALFactory;

namespace KPIS.GERP.GIMS.BLL
{
    public class PrePurchaseRequestBLL : IBLLPrePurchaseRequest
    {
        private static readonly IDALPrePurchaseRequest dal = DataAccess.CreatePrePurchaseRequest();

        public PrePurchaseRequestBLL()
        {

        }

        public IList<PrePurchaseRequestInfo> GetPrePurchaseRequest()
        {
            return dal.GetPrePurchaseRequest();
        }

        public IList<PrePurchaseRequestInfo> GetPrePurchaseRequest(int yearTypeSeq, int year, Nullable<int> JobSiteSeq, Nullable<int> PprType, Nullable<int> ProgressSeq, string StatusSeq)
        {
            return dal.GetPrePurchaseRequest(yearTypeSeq, year, JobSiteSeq, PprType, ProgressSeq, StatusSeq);
        }

        public IList<PrePurchaseRequestInfo> GetPrePurchaseRequestUrgent()
        {
            return dal.GetPrePurchaseRequestUrgent();
        }

        public IList<PrePurchaseRequestInfo> GetPrePurchaseRequestUrgent(int yearTypeSeq, int year, Nullable<int> JobSiteSeq, Nullable<int> ProgressSeq, string StatusSeq)
        {
            return dal.GetPrePurchaseRequestUrgent(yearTypeSeq, year, JobSiteSeq, ProgressSeq, StatusSeq);
        }

        public IList<PrePurchaseRequestInfo> GetPrePurchaseRequest(int year_type_seq, int year, Nullable<int> job_site_seq, Nullable<int> pc_type_seq, Nullable<int> ppr_type_seq, Nullable<int> ppr_method_seq, Nullable<int> prog_seq, string record_status)
        {
            return dal.GetPrePurchaseRequest(year_type_seq, year, job_site_seq, pc_type_seq, ppr_type_seq, ppr_method_seq, prog_seq, record_status);
        }

        public IList<PrePurchaseRequestInfo> GetCollectRequest()
        {
            return dal.GetCollectRequest();
        }
        
        public PrePurchaseRequestInfo GetPrePurchaseRequest(int seq)
        {
            return dal.GetPrePurchaseRequest(seq);
        }

        public IList<PrePurchaseRequestInfo> GetCollectRequestGroupItem(Nullable<int> ItemSeq)
        {
            return dal.GetCollectRequestGroupItem(ItemSeq);
        }

        public IList<PrePurchaseRequestInfo> GetDuration(IList<PrePurchaseRequestInfo> infoList)
        {
            return dal.GetDuration(infoList);
        }

        public IList<PrePurchaseRequestInfo> GetDistinctSeq(IList<PrePurchaseRequestInfo> infoList)
        {
            return dal.GetDistinctSeq(infoList);
        }

        public IList<PrePurchaseRequestInfo> GetName(IList<PrePurchaseRequestInfo> infoList)
        {
            return dal.GetName(infoList);
        }

        public IList<PrePurchaseRequestInfo> GetReason(IList<PrePurchaseRequestInfo> infoList)
        {
            return dal.GetReason(infoList);
        }

        public void Insert(PrePurchaseRequestInfo info)
        {
            try
            {
                dal.Insert(info);
            }
            catch
            {
                throw;
            }
        }

        public string Insert(PrePurchaseRequestInfo info, IList<PrePurchaseRequestItemInfo> infoListItem, IList<PrePurchaseRequestCommitteeInfo> infoListCommittee, IList<DocumentInfo> infoListFile)
        {
            try
            {
                return dal.Insert(info, infoListItem, infoListCommittee, infoListFile);
            }
            catch
            {
                throw;
            }
        }

        public string Insert(PrePurchaseRequestInfo info, IList<PrePurchaseRequestItemInfo> infoListItem, IList<DocumentInfo> infoListFile)
        {
            try
            {
                return dal.Insert(info, infoListItem, infoListFile);
            }
            catch
            {
                throw;
            }
        }

        public void Update(PrePurchaseRequestInfo info)
        {
            try
            {
                dal.Update(info);
            }
            catch
            {
                throw;
            }
        }

        public void Delete(PrePurchaseRequestInfo info)
        {
            try
            {
                dal.Delete(info);
            }
            catch
            {
                throw;
            }
        }

        public void DeleteAll(IList<PrePurchaseRequestInfo> infoList)
        {
            try
            {
                dal.DeleteAll(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void DeleteFromDB(IList<PrePurchaseRequestInfo> infoList)
        {
            try
            {
                dal.DeleteFromDB(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void Restore(IList<PrePurchaseRequestInfo> infoList)
        {
            try
            {
                dal.Restore(infoList);
            }
            catch
            {
                throw;
            }
        }

        public void Confirm(PrePurchaseRequestInfo info, IList<PrePurchaseRequestRouteInfo> infoListRoute)
        {
            try
            {
                dal.Confirm(info, infoListRoute);
            }
            catch
            {
                throw;
            }
        }
        public void Approved(PrePurchaseRequestInfo info, IList<PrePurchaseRequestRouteInfo> infoListRoute)
        {
            try
            {
                dal.Approved(info, infoListRoute);
            }
            catch
            {
                throw;
            }
        }
        public IList<HrmEmployeeInfo> GetPrePurchaseRequestOperationName(int pprTypeSeq)
        {
            return dal.GetPrePurchaseRequestOperationName(pprTypeSeq);
        }

        public void SendToPurchaseRequest(int PprSeq, DateTime pr_date, int PrEmpSeq)
        {
            dal.SendToPurchaseRequest(PprSeq, pr_date, PrEmpSeq);
        }
    }
}
